﻿/**********************************************************
 Name：Menu
 Author：
 Date：2012-08-18 20:46:10
 Description：
 ---------------------------------------------------------
 Modify Date:
 Modify Remark:
 ---------------------------------------------------------
 Modify Date:
 Modify Remark:
**********************************************************/
using System;
using PetaPoco;
using System.Collections.Generic;

namespace QuickLifeHall.Entity.SystemBase
{
    /// <summary>
    /// This Entity is Mapping To [Menu] Table
    /// Remark Ignore Attribute for the field when it is not need mapping
    /// </summary>
    [Serializable]
    [TableName("Menu")]
    [PrimaryKey("MenuID", autoIncrement = true)]
    public class Menu
    {
        /// <summary>
        /// MenuID
        /// </summary>
        public int MenuID
        {
            get;
            set;
        }

        /// <summary>
        /// MenuName
        /// </summary>
        public string MenuName
        {
            get;
            set;
        }

        /// <summary>
        /// Icon
        /// </summary>
        public string Icon
        {
            get;
            set;
        }

        /// <summary>
        /// Url
        /// </summary>
        public string Url
        {
            get;
            set;
        }

        /// <summary>
        /// ParentID
        /// </summary>
        public Nullable<int> ParentID
        {
            get;
            set;
        }

        /// <summary>
        /// State
        /// </summary>
        public int State
        {
            get;
            set;
        }

        /// <summary>
        /// 子菜单
        /// </summary>
        [PetaPoco.Ignore]
        public List<Entity.SystemBase.Menu> children
        {
            get;
            set;
        }

        /// <summary>
        /// 子节点个数
        /// </summary>
        [PetaPoco.ResultColumn]
        public int ChildrenCount
        {
            get;
            set;
        }

        /// <summary>
        /// Equals
        /// </summary>
        public override bool Equals(object obj)
        {
            Menu other = obj as Menu;
            if (other == null || this.MenuID == 0 || other.MenuID == 0)
            {
                return false;
            }
            if (this.MenuID != other.MenuID)
            {
                return false;
            }
            return true;
        }
        /// <summary>
        /// GetHashCode
        /// </summary>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
